package com.prs.crm.action.sale.flow;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;

import com.prs.crm.action.FlowAction;
import com.prs.crm.annotation.Clew;
import com.prs.crm.context.AppContext;
import com.prs.crm.domain.sale.QuotationSheet;
import com.prs.crm.domain.store.Inventory;
import com.prs.crm.service.sale.QuotationSheetService;
import com.prs.crm.service.stock.InventoryService;

public class QuotationSheetFlowAction extends FlowAction<QuotationSheet> {
	
	private QuotationSheet quotationSheet;
	private QuotationSheetService quotationSheetService;	
	private PaginationSupport pagination;
	
	
	@Action("listQuotationSheetFlow")
	public String listQuotationSheetFlow() {
		pagination = this.getPaginationHelper().prepare(pagination);
		pagination = this.getQuotationSheetService().listFlowTask(QuotationSheet.class, pagination, AppContext.getAccountContext().currentUser());
		return SUCCESS;
	}
	
	@Action("editQuotationSheetFlow")
	public String editQuotationSheetFlow() {
		this.displayEndNodes();		
		return SUCCESS;
	}
	
	@Clew(results={"success"})
	@Action(value="submitQuotationSheetFlow",results={@Result(name="success",type="redirect",location="listSalesContractFlow")})
	public String submitQuotationSheetFlow() {
		this.getQuotationSheetService().execute(this.getNode(), this.getDetail(), quotationSheet, AppContext.getAccountContext().currentUser());
		this.setPrompt("提交成功");
		return SUCCESS;
	}

	
	public QuotationSheet getQuotationSheet() {
		return quotationSheet;
	}

	public void setQuotationSheet(QuotationSheet quotationSheet) {
		this.quotationSheet = quotationSheet;
	}

	public QuotationSheetService getQuotationSheetService() {
		return quotationSheetService;
	}

	public void setQuotationSheetService(QuotationSheetService quotationSheetService) {
		this.quotationSheetService = quotationSheetService;
	}

	public PaginationSupport getPagination() {
		return pagination;
	}

	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	
	
	
	
	
	
	

}
